﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using VS4CRM.Lib;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk;

namespace Poligon
{
    class Program
    {
        static void Main(string[] args)
        {
            CrmService service = new CrmService();
            service.UseDefaultCredentials = true;
            service.Url = "http://localhost:5555/mscrmservices/2007/crmservice.asmx";
            service.CrmAuthenticationTokenValue = new CrmAuthenticationToken() { OrganizationName = "CAPromise" };

            SynchronizationUtility sync = new SynchronizationUtility(service);
            sync.ProgressChanged += new EventHandler<SynchronizationProgressEventArgs>(sync_ProgressChanged);
            sync.RefreshProject(@"E:\Projects\Test\Test\test.csproj", true);
            
            //sync.CompileCustomization(@"E:\Projects\Test\Test\Entities", true);
            //sync.PushCustomizations(true, true);
            //sync.SaveAsZip("test.zip");
        }

        static void sync_ProgressChanged(object sender, SynchronizationProgressEventArgs e)
        {
            Console.WriteLine(String.Format("{0}%, {1}", e.Completed, e.Text)); 
        }
    }
}
